package com.xianda.spring.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import javax.sql.DataSource;

@ComponentScan
@Configuration
//@PropertySource(value = "classpath:dbconfig/database.properties", encoding = "utf-8")
@PropertySource(value = {"classpath:db_config/database.properties","classpath:db_config/druid.properties"}, encoding = "utf-8")
public class DataSourceConfig {
	@Bean
	@ConfigurationProperties(prefix = "spring.datasource")
	public DataSource druidDataSource() {
		DruidDataSource druidDataSource = new DruidDataSource();
		return druidDataSource;
	}
}